package com.zytlifeservice.controller;

import com.zytlifeservice.domain.Result;
import com.zytlifeservice.service.VerifyService;
import com.zytlifeservice.util.ResultUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by MJS on 2017/4/28.
 */

@RestController
@RequestMapping(value = "/verify")
public class VerifyController {
    private static final Logger logger = LoggerFactory.getLogger(VerifyController.class);

    @Autowired
    private VerifyService verifyService;

    /**
     * 要判断该手机号是否和当前userId对应的手机号一致。
     * @param mobile
     * @param type
     * @return
     */
    @PostMapping(value = "/send")
    public Result send(@RequestParam("mobile") String mobile,
                       @RequestParam("type") int type) {
        verifyService.send(mobile,  type);
        return ResultUtil.success();
    }
}
